<?php

declare (strict_types=1);
/**
 * This file is part of Hyperf.
 *
 * @link     https://www.hyperf.io
 * @document https://hyperf.wiki
 * @contact  group@hyperf.io
 * @license  https://github.com/hyperf/hyperf/blob/master/LICENSE
 */
namespace App\Model;

class InformationRent extends Model
{
    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected ?string $table = 'information_rent';
    public static $typeList = [1 => '短租', 2 => '长租'];
    public function information()
    {
        return $this->belongsTo(Information::class, 'information_id');
    }
    public function getRentTypeTextAttribute()
    {
        return static::$typeList[$this->rent_type] ?? '未知';
    }
    public function info()
    {
        return ['title' => $this->title ?? '', 'address' => $this->address ?? '', 'address_location' => ['lat' => $obj->lat ?? '', 'lng' => $obj->lng ?? ''], 'total' => $this->total ?? 0.0, 'type' => $this->rent_type ?? '', 'type_text' => $this->rent_type_text, 'content' => $this->content ?? ''];
    }
}